<?php

/**
 * Proveedores filter form.
 *
 * @package    tercermilenio
 * @subpackage filter
 * @author     Your name here
 */
class ProveedoresFormFilter extends BaseProveedoresFormFilter {

    public function configure() {

    }

    public function setup() {

        parent::setup();


            $options = array(
            '' => 'Todos',
            0 => 'Inactivo',
            1 => 'Activo',
        );

        $this->setWidgets(array(
            'pvd_nombre' => new sfWidgetFormFilterInput(array('with_empty' => false)),
            'pvd_direccion' => new sfWidgetFormFilterInput(array('with_empty' => false)),
            'pvd_provincia' => new sfWidgetFormPropelChoice(array('model' => 'Provincias', 'add_empty' => 'Seleccione una provincia')),
            'pvd_localidad' => new sfWidgetFormPropelChoice(array('model' => 'Localidades', 'add_empty' => 'Seleccione una localidad')),
            'pvd_telefono' => new sfWidgetFormFilterInput(array('with_empty' => false)),
            'pvd_celular' => new sfWidgetFormFilterInput(array('with_empty' => false)),
            'pvd_mail' => new sfWidgetFormFilterInput(array('with_empty' => false)),
            //'pvd_estado' => new sfWidgetFormFilterInput(array('with_empty' => false)),
            'pvd_estado' => new sfWidgetFormChoice(array('choices' => $options)),
        ));

        $this->setValidators(array(
            'pvd_nombre' => new sfValidatorString(array('required' => false)),
            'pvd_nro_documento' => new sfValidatorInteger(array('required' => false)),
            'pvd_direccion' => new sfValidatorString(array('required' => false)),
            'pvd_provincia' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Provincias', 'column' => 'pcia_id')),
            'pvd_localidad' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Localidades', 'column' => 'loc_id')),
            'pvd_telefono' => new sfValidatorString(array('required' => false)),
            'pvd_celular' => new sfValidatorString(array('required' => false)),
            'pvd_mail' => new sfValidatorString(array('required' => false)),
            'pvd_estado' => new sfValidatorChoice(array('required' => false,'choices' => $options)),
        ));

        $this->widgetSchema->setNameFormat('proveedores_filters[%s]');

        $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
    }

}
